<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="main :: common_head">
    <style>
        .changeI {
            display: block;
            width: 100%;
            height: 100%;
        }

        ul li {
            list-style: none;
            margin: 0;
            padding: 0;
        }

        .navbar .nav > li > .dropdown-menu::before {
            display: none !important;
        }

        .navbar .nav > li > .dropdown-menu::after {
            display: none !important;
        }

        .dropdown-menu:hover, .dropdown-menu:hover {
            display: none !important;
        }

        .dropdown-menu:hover::before, .dropdown-menu:hover::after {
            display: none !important;
        }

        #myli > ul:hover::before {
            display: none;
        }

    </style>
</head>

<body>
<!--删除提示模态框-->
<div class="modal fade" id="delcfmModel1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">提示</h4>
            </div>
            <div class="modal-body">警告:删除该图谱后，图谱中包含的设备、电价信息以及关联关系都将被删除！<br>是否删除？</div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="deleteChartById()">确定</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<!--删除提示模态框结束-->
<div id="app">
<div class="container-fluid-full">

    <div class="row-fluid">

        <noscript>
            <div class="alert alert-block span10">
                <h4 class="alert-heading">Warning!</h4>
                <p>You need to have <a href="#" target="_blank">JavaScript</a> enabled to use this site.</p>
            </div>
        </noscript>

        <!-- start: Content -->
        <div id="content" class="span10" style="width: 100%">
            <ul class="breadcrumb" th:if="${#request.getParameter('breadcrumb') == 'true'}">
                <li>
                    <!-- <i class="icon-home"></i> -->
                    <i class="fas fa-circle-notch"></i>
                    <a id="home" href="#" onclick="parent.location.reload()">主页</a>
                    <i class="icon-angle-right"></i>
                </li>
                <li><a href="#">图谱展示</a></li>
            </ul>

            <div class="row-fluid sortable">
                <div class="box span12">
                    <div class="box-header" data-original-title>
                        <h2><i class="halflings-icon white user"></i><span class="break"></span>图谱列表</h2>
                        <div class="box-icon"></div>
                    </div>
                    <!-- 跑马灯 -->
                    <div th:if="${flag} eq false" onmouseenter="pauseMarquee()" onmouseleave="startMarquee()">
                        <marquee id="marquee" style="margin: 0px;color:red;" bgcolor="blanchedalmond" direction="left" behavior="alternate">
                            图谱使用时间存在未闭合时间段
                        </marquee>
                    </div>

                    <div class="box-content" style="height: 500px;">
                        <div class="container" style="margin-left: 0px ;margin-bottom: 10px;">
                            <a class="btn btn-primary" th:href="@{/knowChartAdd.html}">添加图谱</a>
                        </div>
                        <table class="table table-striped table-bordered bootstrap-datatable datatable">
                            <thead>
                            <tr>
                                <th>图谱ID</th>
                                <th>图谱名称</th>
                                <th>季节显示</th>
                                <th>使用时间</th>
                                <th>工作时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="graph:${graphInfoList}">
                                <td th:text="${graph.graphId}">1</td>
                                <td class="center" th:text="${graph.graphName}">主机组</td>
                                <td class="center" th:if="${graph.graph_type == 1 || graph.graph_type == null}">供冷季</td>
                                <td class="center" th:if="${graph.graph_type == 2}">过渡季</td>
                                <td class="center" th:if="${graph.graph_type == 3}">供热季</td>
                                <td class="center" th:text="${graph.graphStartTime}+'至'+${graph.graphEndTime}">主机组</td>
                                <td class="center" th:text="${graph.startWorkTime}+'至'+${graph.endWorkTime}">主机组</td>
                                <td class="center">
                                    <a class="btn btn-info" title="图谱信息修改"
                                       th:href="@{'/graphInfo/get/'+${graph.graphId}(start=${graph.graphStartTime},end=${graph.graphEndTime})}">修改</a>
                                    <a class="btn btn-danger" href="#" title="删除" th:id="${graph.graphId}"
                                       onclick="deleteChart()">删除</a>
                                    <a class="btn btn-primary" href="#" title="图谱位置编辑"
                                       th:href="@{/graphInfo/viewChartDrawPage/}+${graph.graphId}">编辑</a>
                                </td>
                            </tr>
                            <!--<tr>-->
                            <!--<td>1</td>-->
                            <!--<td>夏季图谱</td>-->
                            <!--<td>2020/3/20-2020/3/21</td>-->
                            <!--<td>-->
                            <!--<a class="btn btn-info" title="修改" >-->
                            <!--<i class="halflings-icon white edit"></i>-->
                            <!--</a>-->
                            <!--&lt;!&ndash;<a  class="btn btn-danger" >&ndash;&gt;-->
                            <!--&lt;!&ndash;<i th:id="${device.deviceId}" class="halflings-icon white trash changeI"  onclick="deleteDevice()"></i>&ndash;&gt;-->
                            <!--&lt;!&ndash;</a>&ndash;&gt;-->
                            <!--<a  class="btn btn-danger" href="#" title="删除" >-->
                            <!--删除-->
                            <!--</a>-->
                            <!--</td>-->
                            <!--</tr>-->
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div><!--/.fluid-container-->
        <!-- end: Content -->
    </div><!--/#content.span10-->
</div><!--/fluid-row-->
</div>

<div class="modal hide fade" id="myModal">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">×</button>
        <h3>Settings</h3>
    </div>
    <div class="modal-body">
        <p>Here settings can be configured...</p>
    </div>
    <div class="modal-footer">
        <a href="#" class="btn" data-dismiss="modal">Close</a>
        <a href="#" class="btn btn-primary">Save changes</a>
    </div>
</div>
<div class="common-modal modal fade" id="common-Modal1" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-content">
        <ul class="list-inline item-details">
            <li><a href="http://sc.chinaz.com">Admin templates</a></li>
            <li><a href="http://sc.chinaz.com">Bootstrap themes</a></li>
        </ul>
    </div>
</div>

<div class="clearfix"></div>

<div th:replace="main::common_js"></div>
<script th:inline="javascript" th:src="@{/js/vue.min.js}"></script>

<script>

    var vm = new Vue({
        el:'#app',
        mounted: function() {
            parent.modifyTitle('图谱管理')
        },
    })
    // breadcrumb()
    // window.onload = function() {
    //     parent.modifyTitle('图谱管理')
    // }

    // 检查多张图谱使用时间是否连续
    function pauseMarquee() {
        document.getElementById("marquee").stop()
    }
    function startMarquee() {
        document.getElementById("marquee").start()
    }
</script>

<script th:src="@{/js/detect-element-resize.js}"></script>
<script th:src="@{/js/iframe-resize.js}"></script>

<script>
    var deleteChartId = ""; //删除的图谱id
    //点击删除时弹出模态框
    function deleteChart() {
        $("#delcfmModel1").modal("show");
        deleteChartId = $(event.target).attr("id"); //获取当前点击按钮的id
        console.log(deleteChartId);
    }

    //删除图谱
    function deleteChartById() {
        $.ajax({
            type: "GET",
            url: "/multipower/graphInfo/delete/" + deleteChartId,
            success: function (data) {
                $("#delcfmModel1").modal("hide");
                location.reload();
            }
        })
    }

    // function hasParent() {
    //     if (parent.length <= 0) {
    //         $(".breadcrumb").remove()
    //     }
    // }
    //
    // hasParent()

</script>
</body>
</html>
